package net.orange.architecture.db;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * The set of order.
 */
public class Orders {

	/**
	 * The set of order.
	 */
	private Collection<Order> items;

	/**
	 * The default to initialize the set of the order.
	 */
	public Orders() {
		items = new ArrayList<Order>();
	}

	/**
	 * @return Returns the fields.
	 */
	public Collection getItems() {
		return items;
	}

	/**
	 * @param fields
	 *            The fields to set.
	 */
	public void setItems(Collection<Order> items) {
		this.items = items;
	}

	/**
	 * Add the order in collection.
	 * 
	 * @param od
	 *            The order.
	 */
	public void add(Order od) {
		items.add(od);
	}

	/**
	 * Remove the order from collection.
	 * 
	 * @param od
	 *            The order.
	 */
	public void remove(Order od) {
		items.remove(od);
	}

	/**
	 * Clear the collection.
	 */
	public void clear() {
		items.clear();
	}

	/**
	 * @return Returns whether the collection is empty.
	 */
	public boolean isEmpty() {
		return items.isEmpty();
	}

	/**
	 * @return Returns the order collection.
	 */
	public Iterator iterator() {
		return items.iterator();
	}

	/**
	 * @return Returns the order array.
	 */
	public Order[] toArray() {
		Order[] array = new Order[items.size()];
		return (Order[]) items.toArray(array);
	}

}